﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace Model
{
    [Serializable]
    public partial class Buy4a00
    {
        private int? _cofno;
		private string _plistid;
        private int? _providecode;
		private string _providername;
		private double _pamt;
		private string _cycle;
		private double _foregift;
		private string _usercode;
		private string _listid;
		
        /// <summary>
        /// 合同代码
        /// </summary>
		public int? Cofno
		{
			get { return _cofno;	 }
			set { _cofno=value;	}
		}
        /// <summary>
        /// 供应商标识
        /// </summary>
		public string Plistid
		{
			get { return _plistid;	 }
			set { _plistid=value;	}
		}
        /// <summary>
        /// 供应商代码
        /// </summary>
		public int? Providecode
		{
			get { return _providecode;	 }
			set { _providecode=value;	}
		}
        /// <summary>
        /// 供应商名称
        /// </summary>
		public string Providername
		{
			get { return _providername;	 }
			set { _providername=value;	}
		}
        /// <summary>
        /// 预付款
        /// </summary>
		public double Pamt
		{
			get { return _pamt;	 }
			set { _pamt=value;	}
		}
        /// <summary>
        /// 付款周期
        /// </summary>
		public string Cycle
		{
			get { return _cycle;	 }
			set { _cycle=value;	}
		}
        /// <summary>
        /// 押金
        /// </summary>
		public double Foregift
		{
			get { return _foregift;	 }
			set { _foregift=value;	}
		}
        /// <summary>
        /// 用户名
        /// </summary>
		public string Usercode
		{
			get { return _usercode;	 }
			set { _usercode=value;	}
		}
        /// <summary>
        /// 合同主键标识
        /// </summary>
		public string Listid
		{
			get { return _listid;	 }
			set { _listid=value;	}
		}
		
		public static List<Buy4a00> GetBuy4a00ListByDataTable(DataTable dt)
		{
			if(dt == null) return null;
		    List<Buy4a00> list = new List<Buy4a00>();
		   
			foreach(DataRow dr in dt.Rows)
            {
				Buy4a00 model = GetBuy4a00ByDataRow(dr);
				if(null == model) continue;
				
				list.Add(model);
            }
           return list;
		}
		
		public static Buy4a00 GetBuy4a00ByDataRow(DataRow dr)
		{
			Buy4a00 model = new Buy4a00(); //实例化Buy4a00
	
			DataColumnCollection dcc = dr.Table.Columns;

			if (dcc.Contains("cofno")&&!(dr["cofno"] is System.DBNull))  
				model.Cofno = ( int)dr["cofno"];
			if (dcc.Contains("plistid")&&!(dr["plistid"] is System.DBNull))  
				model.Plistid = ( string)dr["plistid"];
			if (dcc.Contains("providecode")&&!(dr["providecode"] is System.DBNull))  
				model.Providecode = ( int)dr["providecode"];
			if (dcc.Contains("providername")&&!(dr["providername"] is System.DBNull))  
				model.Providername = ( string)dr["providername"];
			if (dcc.Contains("pamt")&&!(dr["pamt"] is System.DBNull))  
				model.Pamt = Convert.ToDouble(dr["pamt"]);
			if (dcc.Contains("cycle")&&!(dr["cycle"] is System.DBNull))  
				model.Cycle = ( string)dr["cycle"];
			if (dcc.Contains("foregift")&&!(dr["foregift"] is System.DBNull))  
				model.Foregift = Convert.ToDouble(dr["foregift"]);
			if (dcc.Contains("usercode")&&!(dr["usercode"] is System.DBNull))  
				model.Usercode = ( string)dr["usercode"];
			if (dcc.Contains("listid")&&!(dr["listid"] is System.DBNull))  
				model.Listid = ( string)dr["listid"];
			
			return model;
		}
    }
}
